package net.wanho.bean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * Author：汤小洋
 * Date：2024-12-11 16:18
 * Description：<描述>
 */
@Component("springBean")
// @Lazy
@Scope("prototype")
public class SpringBean {

    @Value("${shop.name}")
    private String name;

    public SpringBean() {
        System.out.println("SpringBean 构造方法..........");
    }

    public void show(){
        System.out.println("执行show方法......" + name);
    }


    // 初始化方法，执行初始化操作
    @PostConstruct
    public void init(){
        this.name = name.toUpperCase();
    }
}
